package sel.me.spring.boot159.web.extension.event;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @author shenenlu 2021年03月05日 下午16:40:54
 */
@Component
public class EventPublisherContext implements ApplicationContextAware {

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        EmailEvent event = new EmailEvent("helloEventPublisherContext","boylmx@163.com","this is a email text!");
        applicationContext.publishEvent(event);
    }
}
